package com.yantong.constant;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * 订单拼团状态
 */
public enum OrderSpellGroupStatus {
    SPELL_GROUPING(1, "拼团中"),
    SPELL_SUCCESS(2, "拼团成功"),
    SPELL_FAILED(3, "拼团不中"),
    SPELL_CANCEL(4, "用户取消"),
    ;

    private int code;
    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }



    private static Map<Integer, String> all= new HashMap<>();
    static{
        for(OrderSpellGroupStatus orderStatus: EnumSet.allOf(OrderSpellGroupStatus.class)){
            all.put(orderStatus.code, orderStatus.msg);
        }
    }
    public static String get(Integer code){
        return all.get(code);
    }

    OrderSpellGroupStatus(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
